//
//  ZYCAttendanceStatusGroupBorderView.m
//  ZDSC
//
//  Created by 张威 on 2021/10/22.
//

#import "ZYCAttendanceStatusGroupBorderView.h"
@interface ZYCAttendanceStatusGroupBorderView ()

@property (nonatomic, strong) UILabel *numCountLabel;
@property (nonatomic, strong) UILabel *statusLabel;

@end
@implementation ZYCAttendanceStatusGroupBorderView

- (void)setTitle:(NSString *)title{
    _title = title;
    _statusLabel.text = title;
}

- (void)setCount:(NSString *)count{
    _count = count;
    _numCountLabel.text = [NSString stringWithFormat:@"%@",count];
}

- (void)setColor:(UIColor *)color{
    _color = color;
    _numCountLabel.layer.borderColor = color.CGColor;
    _numCountLabel.textColor = color;
    _statusLabel.textColor = color;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.numCountLabel];
        [self addSubview:self.statusLabel];
        
        [self.numCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self).offset(10.0f);
            make.size.mas_equalTo(CGSizeMake(47.5, 47.5));
        }];
        
        [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self.numCountLabel.mas_bottom).offset(10.0f);
        }];
    }
    return self;
}

- (UILabel *)numCountLabel {
    if (!_numCountLabel) {
        _numCountLabel = [[UILabel alloc] init];
        _numCountLabel.layer.cornerRadius = 47.5 / 2;
        _numCountLabel.layer.borderWidth = 1.0f;
        _numCountLabel.font = kCustomFont(@"PingFangSC-Light", 20.0f);
        _numCountLabel.layer.masksToBounds = YES;
        _numCountLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _numCountLabel;
}


- (UILabel *)statusLabel {
    if (!_statusLabel) {
        _statusLabel = [[UILabel alloc] init];
        _statusLabel.font = kCustomFont(@"PingFangSC-Regular", 14.0f);
        _statusLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _statusLabel;
}


@end
